package com.zjy.pgcms.service.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zjy.pgcms.dto.project.ProjectDTO;
import com.zjy.pgcms.entity.Project;
import com.zjy.pgcms.mapper.ProjectMapper;
import com.zjy.pgcms.service.ProjectService;
import com.zjy.pgcms.util.BaseUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 *
 */
@Service
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project>
    implements ProjectService {

    @Override
    public Project getInstance(HttpServletRequest request, ProjectDTO dto) {
        Long userId = BaseUtil.getLoginUserId(request);
        Date createTime = new Date();
        Date updateTime = createTime;

        Project project = dto.transformToProject();
        project.setUserId(userId);
        project.setCreateTime(createTime);
        project.setUpdateTime(updateTime);

        return project;
    }
}




